package cn.gemiman.daoyi.module.cms.controller.admin.articledetail.vo;

import cn.gemiman.daoyi.framework.excel.core.annotations.DictFormat;
import cn.gemiman.daoyi.framework.excel.core.convert.DictConvert;
import cn.gemiman.daoyi.module.cms.controller.admin.articlecategory.vo.CmsArticleCategoryRespVO;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

@Schema(description = "管理后台 - 文章 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ArticleDetailRespVO {

    @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12578")
    @ExcelProperty("编号")
    private Long id;

    @Schema(description = "站点编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18359")
    @ExcelProperty("站点编号")
    private Long appSiteId;

    @Schema(description = "站点标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "11")
    @ExcelProperty("站点标识")
    private String appId;

    @Schema(description = "栏目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10356")
    @ExcelProperty("栏目编号")
    private Long categoryId;

    @Schema(description = "栏目")
    private CmsArticleCategoryRespVO category;

    @Schema(description = "标题", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("标题")
    private String title;

    @Schema(description = "副标题")
    @ExcelProperty("副标题")
    private String subTitle;

    @Schema(description = "主图")
    @ExcelProperty("主图")
    private String mainPic;

    @Schema(description = "文章图册")
    @ExcelProperty("文章图册")
    private List<String> articlePhotos;

    @Schema(description = "简要")
    @ExcelProperty("简要")
    private String articleShortDesc;

    @Schema(description = "内容")
    @ExcelProperty("内容")
    private String articleContent;

    @Schema(description = "文章状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @ExcelProperty(value = "文章状态", converter = DictConvert.class)
    @DictFormat("common_status") // TODO 代码优化：建议设置到对应的 DictTypeConstants 枚举类中
    private Integer status;

    @Schema(description = "点击量", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("点击量")
    private Integer viewNum;

    @Schema(description = "排序")
    @ExcelProperty("排序")
    private Integer sort;

    @Schema(description = "标签")
    @ExcelProperty("标签")
    private List<String> tags;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

    @Schema(description = "最后更新时间")
    @ExcelProperty("最后更新时间")
    private LocalDateTime updateTime;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "阅读时长")
    private Long readingDuration;

    /**
     * 来源类型
     */
    @Schema(description = "来源类型")
    private Integer originType;

    /**
     * 来源地址
     */
    @Schema(description = "来源地址")
    private String originUrl;

    @Schema(description = "作者")
    private String authorName;

    @Schema(description = "点赞数量")
    private Long thumbsUpTimes = 0L;
}
